package servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
 *      请求转发的特点:
 *      --浏览器地址栏没有发生变化
 *      -可以转发到WEB-INF目录下
 *      -他们是一次请求
 *      -共享request数据
 *      -不可以访问工程以外的数据
 *
 */
public class forwarRequest extends HttpServlet {
    public forwarRequest() {
        super();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取材料
        String s = req.getParameter("user");
        System.out.println("材料: "+s);
        //获取章
        Object str = req.getAttribute("key");
        System.out.println("获取章"+str);
        //处理业务
        System.out.println("业务处理中");


    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
